<template>
  <div>
    <div v-for="comment in comments" :key="comment.id">
      <comment :comment="comment"></comment>
    </div>
  </div>


</template>

<script>
    import Comment from "../../components/restaurant/Comment";
    export default {
        name: "Comments",
      components: {Comment},
      data() {
          return {
            //需要从服务端获取
            comments: [],
          }
      },
      created() {
        this.$axios({
          method: "get",
          url: "/rest/comments",
          params: {
            rid: this.$store.getters.rid
          }
        })
          .then(response => {
            if (response.data.success) {
              this.comments=response.data.rest_comments_list;
            }
            console.log(response.data.message);
          })
          .catch(error => console.log(error));
      }
    }
</script>

<style scoped>

</style>
